package com.ss.android.newmedia.a;

import android.content.Context;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class TimeFormatter {
    private static TimeFormatter sInstance;
    private final SimpleDateFormat b;
    private String c;
    private String d;
    private String e;
    private Date f;
    private Calendar g;

    public TimeFormatter(Context arg3) {
        this.b = new SimpleDateFormat("MM-dd HH:mm");
        this.c = arg3.getString(com.ss.android.article.browser.R.string.ss_time_minute);
        this.d = arg3.getString(com.ss.android.article.browser.R.string.ss_time_hour);
        this.e = arg3.getString(com.ss.android.article.browser.R.string.ss_time_now);
        this.f = new Date();
        this.g = Calendar.getInstance();
    }

    public static TimeFormatter getInstance(Context context) {
        if(TimeFormatter.sInstance == null) {
            Class v1 = TimeFormatter.class;
            synchronized (v1){
                if(TimeFormatter.sInstance == null) {
                    TimeFormatter.sInstance = new TimeFormatter(context.getApplicationContext());
                }
            }
        }

        return TimeFormatter.sInstance;
    }

    public final String a(long arg14) {
        String v0_1;
        long v10 = 3600;
        long v8 = 60;
        long v0 = System.currentTimeMillis();
        long v2 = (v0 - arg14) / 1000;
        if(v2 < v8) {
            v0_1 = this.e;
        }
        else if(v2 < v10) {
            v0_1 = v2 / v8 + this.c;
        }
        else {
            if(v2 < 86400) {
                this.g.setTimeInMillis(v0);
                this.g.set(11, 0);
                this.g.set(12, 0);
                this.g.set(13, 0);
                if(arg14 >= this.g.getTimeInMillis()) {
                    return v2 / v10 + this.d;
                }
            }

            this.f.setTime(arg14);
            v0_1 = this.b.format(this.f);
        }

        return v0_1;
    }
}

